import React from "react";
import type { PropsWithChildren } from "react";
import { SafeAreaView, ScrollView, StatusBar, StyleSheet, Text, useColorScheme, View  } from "react-native";
import { Colors, DebugInstructions, Header, LearnMoreLinks, ReloadInstructions } from "react-native/Libraries/NewAppScreen";
import { NavigationContainer } from "@react-navigation/native";
import { createStackNavigator } from "@react-native-oh-tpl/stack";
import { enableScreens } from "@react-native-oh-tpl/react-native-screens";
enableScreens(true);
type SectionProps = PropsWithChildren<{
  title: string;
}>;
const Stack = createStackNavigator();
import Page1 from "./Page1";
import Page2 from "./Page2";
import Page3 from "./Page3";

function Section({ children, title }: SectionProps): JSX.Element {
  const isDarkMode = useColorScheme() === "dark";
  return (
    <View style={styles.sectionContainer}>
      <Text
        style={[
          styles.sectionTitle,
          {
            color: isDarkMode ? Colors.white : Colors.black,
          },
        ]}
      >
      </Text>
    </View>
  )
}

function App(): JSX.Element { 
    const isDarkMode = useColorScheme() === "dark";

    const backgroundStyle = {
      backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
    };

    return ( 
        <NavigationContainer>
         <Stack.Navigator
            initialRouteName="Page1"
            screenOptions={{
                detachPreviousScreen: false, // 确保前一个屏幕不被卸载
            }}
            detachInactiveScreens={false}
          >
            <Stack.Screen name="Page1" component={Page1} />
            <Stack.Screen name="Page2" component={Page2} />
            <Stack.Screen name="Page3" component={Page3} />
          </Stack.Navigator>
        </NavigationContainer>
    );
}

const styles = StyleSheet.create({
  sectionContainer: {
    marginTop: 32,
    paddingHorizontal: 24,
  },
  sectionTitle: {
    fontSize: 24,
    fontWeight: "600",
  },
  sectionDescription: {
    marginTop: 8,
    fontSize: 18,
    fontWeight: "400",
  },
  highlight: {
    fontWeight: "700",
  }
})

export default App;